package com.hyz.controller;

import com.hyz.model.dto.ApprovalResultRequest;
import com.hyz.model.vo.AssetSecondmentResponse;
import com.hyz.service.permission.ApproveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pojo.ResponseResult;

import java.util.List;

/**
 * @author HGD
 * @date 2022/10/9 11:43
 */
@Api("部门审批人员")
@RestController
@RequestMapping("/approve")
@PreAuthorize("hasAnyAuthority('rights','approve')")
public class ApproveController {
    @Autowired
    private ApproveService apService;

    @ApiOperation("部门审批人员获取所有本部门的用户id的借用申请")
    @PostMapping("/apGetAssetSecondments")
    public ResponseResult<List<AssetSecondmentResponse>> apGetAssetSecondments() {
        return apService.apGetAssetSecondments();
    }

    @ApiOperation("部门审批人员审批本部门的申请")
    @PostMapping("/apUpdateAssetSecondment")
    public ResponseResult<List<AssetSecondmentResponse>> apUpdateAssetSecondment(@RequestBody ApprovalResultRequest request) {
        return apService.apUpdateAssetSecondment(request);
    }
}
